]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
keyboard: Forward input purpose from KeyboardController
authorCarlos Garnacho <carlosg@gnome.org>
Fri, 26 Jan 2024 15:20:30 +0000 (16:20 +0100)
committerCarlos Garnacho <carlosg@gnome.org>
Thu, 29 Feb 2024 15:34:21 +0000 (16:34 +0100)
Instead of adding more emoji/keypad signals, forward the input
purpose, so that in future commits the Keyboard object can figure
out the right layout from the purpose hint.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3162>

js/ui/keyboard.js

index 0c68a5971dd4846da73aca77e105d7aa4c48f44a..224e74f973423254754c2d9635dbc24bf1c26fb2 100644 (file)
@@ -1421,6 +1421,7 @@ export const Keyboard = GObject.registerClass({
             'active-group', this._onGroupChanged.bind(this),
             'groups-changed', this._onKeyboardGroupsChanged.bind(this),
             'panel-state', this._onKeyboardStateChanged.bind(this),
+            'purpose-changed', this._onPurposeChanged.bind(this),
             'keypad-visible', this._onKeypadVisible.bind(this),
             this);
         global.stage.connectObject('notify::key-focus',
@@ -1434,6 +1435,11 @@ export const Keyboard = GObject.registerClass({
         this._relayout();
     }
 
+    _onPurposeChanged(controller, purpose) {
+        this._purpose = purpose;
+        this._updateKeys();
+    }
+
     _onKeyFocusChanged() {
         let focus = global.stage.key_focus;
 
@@ -2198,6 +2204,7 @@ class KeyboardController extends Signals.EventEmitter {
 
         this.emit('emoji-visible', emojiVisible);
         this.emit('keypad-visible', keypadVisible);
+        this.emit('purpose-changed', purpose);
     }
 
     getGroups() {